home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / init.d / mountdevsubfs.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  2012-03-27  |  1.5 KB  |  77 lines

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          mountdevsubfs
  4. # Required-Start:    mountkernfs
  5. # Required-Stop:
  6. # Should-Start:      udev
  7. # Default-Start:     S
  8. # Default-Stop:
  9. # Short-Description: Mount special file systems under /dev.
  10. # Description:       Mount the virtual filesystems the kernel provides
  11. #                    that ordinarily live under the /dev filesystem.
  12. ### END INIT INFO
  13. #
  14. # This script gets called multiple times during boot
  15. #
  16.  
  17. PATH=/sbin:/bin
  18. TTYGRP=5
  19. TTYMODE=620
  20. [ -f /etc/default/devpts ] && . /etc/default/devpts
  21.  
  22. TMPFS_SIZE=
  23. [ -f /etc/default/tmpfs ] && . /etc/default/tmpfs
  24.  
  25. KERNEL="$(uname -s)"
  26.  
  27. . /lib/lsb/init-functions
  28. . /lib/init/mount-functions.sh
  29.  
  30. do_start () {
  31.     #
  32.     # Mount a tmpfs on /dev/shm
  33.     #
  34.     if [ ! -d /dev/shm ]
  35.     then
  36.         mkdir --mode=755 /dev/shm
  37.         [ -x /sbin/restorecon ] && /sbin/restorecon /dev/shm
  38.     fi
  39.     SHM_OPT=
  40.     [ "${SHM_SIZE:=$TMPFS_SIZE}" ] && SHM_OPT=",size=$SHM_SIZE"
  41.     domount tmpfs shmfs /dev/shm tmpfs -onosuid,nodev$SHM_OPT
  42.  
  43.     #
  44.     # Mount /dev/pts
  45.     #
  46.     if [ "$KERNEL" = Linux ]
  47.     then
  48.         if [ ! -d /dev/pts ]
  49.         then
  50.             mkdir --mode=755 /dev/pts
  51.             [ -x /sbin/restorecon ] && /sbin/restorecon /dev/pts
  52.         fi
  53.         domount devpts "" /dev/pts devpts -onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE
  54.     fi
  55. }
  56.  
  57. case "$1" in
  58.   "")
  59.     echo "Warning: mountdevsubfs should be called with the 'start' argument." >&2
  60.     do_start
  61.     ;;
  62.   start)
  63.     do_start
  64.     ;;
  65.   restart|reload|force-reload)
  66.     echo "Error: argument '$1' not supported" >&2
  67.     exit 3
  68.     ;;
  69.   stop)
  70.     # No-op
  71.     ;;
  72.   *)
  73.     echo "Usage: mountdevsubfs [start|stop]" >&2
  74.     exit 3
  75.     ;;
  76. esac
  77.